#pragma once

#ifndef FAKESPRING_H
#define FAKESPRING_H

#include "ForceGenerator.h"

/**
 * A force generator that fakes a stiff spring force, and where
 * one end is attached to a fixed point in space.
 */
class FakeSpring : public ForceGenerator
{
private:
	/** The location of the anchored end of the spring. */
	D3DXVECTOR3 *anchor;
	/** Holds the spring constant. */
	float springConstant;
	/** Holds the damping on the oscillation of the spring. */
	float damping;
public:
	/** Creates a new spring with the given parameters. */
	FakeSpring(D3DXVECTOR3 *anchor, float springConstant, float damping)
		: anchor(anchor), springConstant(springConstant), damping(damping)
	{
	}
	virtual ~FakeSpring() { }
	/** Applies the spring force to the given particle. */
	virtual void updateForce(Particle *particle, float frameTime);
};

#endif